<template>
  <div class="detection_result_detail">
    <c-title text="评估结果详情"></c-title>
    <van-tabs v-model="active" v-if="tabs && tabs.length!==0">
      <van-tab :title="item" v-for="(item,index) in tabs" :key="item">
        <div>
          <div class="header">
              <span>{{list[index].type_name}}</span>
              <span style="margin-right:2.6rem;margin-left: 2.5rem;">评估结果</span>
              <span style="margin-right:1.6rem;">对应身体<br/>部分和区域</span>
              <span style="margin-right:1rem;">可能产生<br/>的症状</span>
          </div>
          <div class="content" v-for="(item,i) in list[index].list" :class="i % 2 == 0 ? 'bg-F9F9F9' : ''" >
              <span style="width:10%;text-align: left;">{{item.code}}</span>
              <span style="text-align: text;">{{item.status_name}}</span>
              <span >{{item.area}}</span>
              <span>{{item.desc}}</span>
          </div>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: 0,
      tabs:[],
      list: [],
      type_name: ""
    };
  },
  activated() {
    this.tabs = [];
    this.getDetail()
  },
  methods: {
    async getDetail() {
      let { result, msg, data } = await $http.get('plugin.health-check.frontend.index.detail', { id: this.$route.params.id || this.$route.query.id })
      if (result == 0) {
        return this.$toast(msg);
      }
      data.forEach(item => {
        this.tabs.push(item.type_name + '评估报告')
      })
      console.log(data);
      this.list = data;
      // this.type_name = data.type_name || '腰椎'
    }
  }
};
</script>

<style scoped lang="scss">
// ::v-deep .van-tabs__nav{
//   padding-left: 0.75rem;
// }
// ::v-deep .van-tabs__line{
//   bottom: 21px !important;
//   width: 75px !important;
// }
// ::v-deep .van-tab{
//   flex:unset;
//   margin-right: 1.5rem;
// }

.detection_result_detail {
  background: #fff;
  min-height: 100vh;
  .bg-F9F9F9{
    background: #F9F9F9 !important;
  }
  .content{
    text-align: left;
    display: flex;
    align-items: center;
    background: #fff;
    justify-content: space-evenly;
    color:#999999;
    padding:.75rem 0 .75rem .75rem;
    span{
      font-size: 0.75rem;
      text-align: center;
      width: 25%;
    }
  }
  .header{
    font-size: 0.9375rem;
    text-align: left;
    display: flex;
    align-items: center;
    background: #00AEA6;
    color:#fff;
    padding:  .75rem;
    justify-content: space-evenly;
  }

  table {
    min-height: 25px;
    line-height: 25px;
    text-align: center;
    border-collapse: collapse;
    width: max-content;
  }

  thead {
    background: #F4F4F4;
  }

  table tbody tr {
    border-bottom: 1px solid #E2E2E3;
  }

  table,
  table tr th,
  table tr td {
    padding: 5px 10px;
  }
}
</style>
